package com.cloud.DrugManagement.service.Impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cloud.DrugManagement.mapper.ReceiptHeaderMapper;
import com.cloud.DrugManagement.pojo.ReceiptHeader;
import com.cloud.DrugManagement.service.ReceiptHeaderService;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * @author zhozixiong
 * @date 2023/02/19
 */
@Service
public class ReceiptHeaderServiceImpl extends ServiceImpl<ReceiptHeaderMapper, ReceiptHeader> implements ReceiptHeaderService {

    private final static int SIZE = 10;

    @Override
    public Page<ReceiptHeader> searchAllOrOid(int pages, Long oid) {
        Page page = new Page(pages, SIZE);
        return baseMapper.searchAllOrOid(page, oid);
    }

    @Override
    public ReceiptHeader searchAllByOid(Long oid) {
        return baseMapper.searchAllByOid(oid);
    }

    @Override
    public boolean updateTimeAndSigneeByOid(String signee, Long oid) {
        return baseMapper.updateTimeAndSigneeByOid(new Date(), signee, oid) >= 1;
    }
}
